package org.xxpay.pay.channel.huanyukeji;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.util.Assert;
import org.xxpay.common.unify.AbstractPaymentConfig;

public class HuanyukejiConfig extends AbstractPaymentConfig {

    public static final String CHANNEL_NAME = "huanyukeji";

    public static final String REQ_PAY_URL_FIXX = "/pay";

    public static final String REQ_PAY_QUERY_URL_FIXX = "/pay/query";

    public static final String RETURN_VALUE_SUCCESS = "1";
    public static final String RETURN_VALUE_FAIL = "0"; // 失败返回码
    public static final String RESPONSE_RESULT_SUCCESS = "success"; // 返回上游成功
    public static final String RESPONSE_RESULT_OK = "success"; // 返回上游成功
    public static final String RESPONSE_RESULT_FAIL = "fail";       // 返回上游失败
    public static final String ORDER_STATUS_SUCCESS = "SUCCESS";
    public static final String ORDER_PAY_STATUS_SUCCESS = "1";
    HuanyukejiConfig(String payParam) {
        Assert.notNull(payParam, "init huanyukeji config error");
        JSONObject object = JSON.parseObject(payParam);
        setAppId(object.getString("appId"));
        setPrivateKey(object.getString("privateKey"));
        setPrivateStorePathPwd(object.getString("md5Key"));
        setPayMode(object.getString("payType"));
        setPublicKey(object.getString("publicKey"));
        setRequestUrl(object.getString("requestUrl"));
    }
}
